using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class UpgradeInverseEntropy:Upgrade {

	public override void InitContext(WeaponSlot weapon,UpgradeInstance instance,UpgradeData boundData) {
		base.InitContext(weapon,instance,boundData);
		if(!instance.extraData.ContainsKey("0")) instance.extraData["0"]="1";
	}

	protected override void ReloadStartEventHandler(object _sender,ReloadStartEventArgs e) {
		base.ReloadStartEventHandler(_sender,e);
		if(!weaponWeapon.currentClip.full) return;
		if((boundInstance.extraData["0"] as string)=="1") boundInstance.extraData["0"]="2";
		else boundInstance.extraData["0"]="1";
	}

	protected override void MobDamagedEventHandler(object _sender,DamageEventArgs e) {
		base.MobDamagedEventHandler(_sender,e);
		if(e.stat.isComposition) return;
		if(e.stat.amount<=0) return;
		Mob sender = _sender as Mob;

		if((boundInstance.extraData["0"] as string)=="1") {
			weapon.owner.buffs[typeof(BuffIgnited)].stacks+=0.2f;
			sender.buffs[typeof(BuffStasis)].stacks+=0.5f;
		} else {
			weapon.owner.buffs[typeof(BuffStasis)].stacks+=0.2f;
			sender.buffs[typeof(BuffIgnited)].stacks+=0.5f;
		}
	}

}
